package com.mimc.framework.utils;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jfinal.aop.Aop;
import com.mimc.framework.manager.MinioManager;
import com.mimc.framework.manager.vo.LocalConf;
import com.mimc.framework.manager.vo.MinioConf;
import com.mimc.service.ShSysConfigService;
import io.minio.MinioClient;

public class ShUtils {
    public static MinioClient getMinio() {
        return MinioManager.me().getMinio();
    }
    public static MinioConf getMinioConf(){
        return MinioManager.me().getMinioConf();
    }
    public static LocalConf getLocalConf(){
        ShSysConfigService shSysConfigService= Aop.get(ShSysConfigService.class);
        String configValue=shSysConfigService.getConfigValueByKey("upload.settings");
        JSONObject jsonObj= JSON.parseObject(configValue);
        JSONObject engine=jsonObj.getJSONObject("engine");
        LocalConf localConf=engine.getObject("local",LocalConf.class);
        return localConf;
    }
}
